package com.example.demo.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "Commodity entity")
@Entity
public class Commodity {

    @Id
    @ApiModelProperty("Commodity ID")
    long id;

    @ApiModelProperty("Commodity name")
    String name;

    @ApiModelProperty("Commodity amount")
    double amount;

    @ApiModelProperty("Commodity sale price")
    double salePrice;

    @ApiModelProperty("Commodity purchase price")
    double purchasePrice;

    @ApiModelProperty("Commodity purchase date")
    String purchaseDate;

    @ApiModelProperty("Commodity sale date")
    String saleDate;

    @ApiModelProperty("Commodity customer id")
    long customer_id;

    @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
    @ApiModelProperty("commodity suppliers")
    private List<Supplier> suppliers = new java.util.ArrayList<>();



}
